package cn.melonlib.cores.graphql.model.bean;

import cn.hutool.core.util.IdUtil;
import lombok.Data;
import lombok.Getter;

@Data
public class GraphQLMutationInfo<RESULT> {

    private boolean status;

    private Integer rows;

    private String messages;

    private Long executeTime=System.currentTimeMillis();

    private String uuid= IdUtil.fastSimpleUUID();

    private String sign;
    private RESULT result;
    private GraphQLErrorBody errorBody;

    public GraphQLMutationInfo() {
    }

    public static GraphQLMutationInfo createInfo(boolean status,int rows,String messages,String sign){
        GraphQLMutationInfo info=new GraphQLMutationInfo();
        info.status=status;
        info.rows=rows;
        info.messages=messages;
        info.sign=sign;
        return info;
    }
    public static <RESULT>GraphQLMutationInfo createInfo(boolean status,int rows,String messages,String sign,RESULT result){
        GraphQLMutationInfo info=new GraphQLMutationInfo();
        info.status=status;
        info.rows=rows;
        info.messages=messages;
        info.sign=sign;
        info.result=result;
        return info;
    }
    public static <RESULT>GraphQLMutationInfo createInfo(boolean status,int rows,String messages,String sign,GraphQLErrorBody errorBody){
        GraphQLMutationInfo info=new GraphQLMutationInfo();
        info.status=status;
        info.rows=rows;
        info.messages=messages;
        info.sign=sign;
        info.errorBody=errorBody;
        return info;
    }

}
